<?php
$this->widget('application.extensions.fancybox.EFancyBox', array('target' => '.product', 'config' => array('width' => 800, 'height' => 520,'type'=>'iframe','hideOnOverlayClick'=>false)));
include_once('menu.php');
?>
<script>
function fill(code) {
    $("#VendorCode").val(code);
}
function batchSub(){
	if(!$("#Category").val()){
		alert('请选择 <?php echo $labels['Category']; ?>');
		return false;
	}
	if(!$("#SubCategory").val()){
		alert('请选择 <?php echo $labels['SubCategory']; ?>');
		return false;
	}
	document.productBatch.submit();
}
</script>
<div style="width:100%; float:left; margin-bottom:10px; text-align:right;">
<form action="" method="post" name="productBatch" id="productBatch">

	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td width="15%" class="td_right"><?php echo $labels['Category']; ?>: </td>
			<td width="35%">
				<?php
				echo CHtml::dropDownList('Category', $model->Category, $data['classes'], array(
					'empty' => '请选择',
					'class'=>'input_size6',
					'ajax' => array(
						'url' => Yii::app()->createUrl('Psi/dynamicClass'),
						'data' => array('class' => 'js:this.value'),
						'update' => '#SubCategory',
					),
				));
				?>
			</td>
			<td width="15%" class="td_right"><?php echo $labels['SubCategory']; ?>: </td>
			<td>
				<?php echo CHtml::dropDownList('SubCategory', $model->SubCategory, $data['subclasses'],array('empty'=>array(''=>'请选择'),'class'=>'input_size6')); ?>
			</td>
		</tr>
		<tr>
			<td class="td_right"><?php echo $labels['OF1']; ?>: </td>
			<td>
				<?php
				echo CHtml::dropDownList('OF1', $model->OF1, $data['OF1'], array(
					'empty' => '请选择',
					'class'=>'input_size6',
					'ajax' => array(
						'url' => Yii::app()->createUrl('Psi/dynamicClass'),
						'data' => array('class' => 'js:this.value'),
						'update' => '#OF2',
					),
				));
				?>
			</td>
			<td class="td_right"><?php echo $labels['OF2']; ?>: </td>		
			<td>
				<?php echo CHtml::dropDownList('OF2', $model->OF2, $data['OF2'],array('empty'=>array(''=>'请选择'),'class'=>'input_size6')); ?>
			</td>
		</tr>		
		<tr>
			<td class="td_right"><?php echo $labels['ProductName']; ?>: </td>
			<td>
				<?php echo CHtml::textField('ProductName',$model->ProductName,array('class'=>'disabled input_size4','disabled'=>'disabled')); ?>
			</td>
			<td class="td_right"><?php echo $labels['VendorCode']; ?>: </td>
			<td>
				<?php echo CHtml::textField('VendorCode',$model->VendorCode,array('style'=>'width:150px;')); ?>
				&nbsp;&nbsp;<a class="product" href="<?=Yii::app()->createUrl('psi/vendorPop')?>">供应商</a>
			</td>
		</tr>				
	</table>
	<table cellspacing="0" cellpadding="0" width="100%" class="tbl" style="float:left;">
		<tr class="head">
			<td width="10%"><?php echo $labels['Color']; ?></td>
			<td width="10%"><?php echo $labels['Style']; ?></td>
			<td width="10%"><?php echo $labels['WeightG']; ?></td>
			<td width="10%"><?php echo $labels['ProdPackL_cm']; ?></td>
			<td width="10%"><?php echo $labels['ProdPackW_cm']; ?></td>
			<td width="10%"><?php echo $labels['ProdPackH_cm']; ?></td>
			<td><?php echo $labels['ProductDetail']; ?>（必填）</td>
		</tr>
		<?php
		$cssArr = array(0 => 'three',1 => 'even', 2 => 'odd');
		for ($i=1;$i<=$data['num'];$i++) {
			$trClass = $cssArr[$i % 3];
			?>
		<tr class="<?= $trClass ?>">
			<td>
				<?php echo CHtml::textField('Color_'.$i,$_POST['Color_'.$i],array('style'=>'width:60px;')); ?>
			</td>
			<td>
				<?php echo CHtml::textField('Style_'.$i,$_POST['Style_'.$i],array('style'=>'width:80px;')); ?>
			</td>
			<td>
				<?php echo CHtml::textField('WeightG_'.$i,$_POST['WeightG_'.$i],array('style'=>'width:50px;')); ?>
			</td>
			<td>
				<?php echo CHtml::textField('ProdPackL_cm_'.$i,$_POST['ProdPackL_cm_'.$i],array('style'=>'width:50px;')); ?>
			</td>
			<td>
				<?php echo CHtml::textField('ProdPackW_cm_'.$i,$_POST['ProdPackW_cm_'.$i],array('style'=>'width:50px;')); ?>
			</td>
			<td>
				<?php echo CHtml::textField('ProdPackH_cm_'.$i,$_POST['ProdPackH_cm_'.$i],array('style'=>'width:50px;')); ?>
			</td>
			<td>
				<?php echo CHtml::textField('ProductDetail_'.$i,$_POST['ProductDetail_'.$i],array('style'=>'width:240px;')); ?>
			</td>
		</tr>
		<?php
		}
		?>
		<tr>
			<td colspan="7" style="text-align:center;"><input type="button" name="productBatch" onclick="batchSub()" value="提交" /></td>
		</tr>
	</table>
</form>
</div>